<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<html>
<head>
    <title>告警配置</title>
    <link type="text/css" rel="stylesheet" href='<spring:url value="/webjars/bootstrap/3.3.5/css/bootstrap.min.css"/>'/>
    <link type="text/css" rel="stylesheet"
          href='<spring:url value="/webjars/bootstrap/3.3.5/css/bootstrap-theme.min.css"/>'/>
    <link type="text/css" rel="stylesheet" href='<spring:url value="/resources/css/content.css"/>'/>
    <script src='<spring:url value="/webjars/jquery/1.11.1/jquery.min.js"/>'></script>
    <script src='<spring:url value="/webjars/bootstrap/3.3.5/js/bootstrap.js"/>'></script>
    <script src='<spring:url value="/webjars/angularjs/1.5.5/angular.min.js"/>'></script>
    <script src='<spring:url value="/webjars/angularjs/1.5.5/angular-resource.js"/>'></script>
    <script src='<spring:url value="/webjars/bootbox/4.4.0/bootbox.js"/>'></script>
    <script src='<spring:url value="/resources/js/common/MessageBox.js"/>'></script>
    <script src='<spring:url value="/resources/js/sysConfiguration/SysConfigurationModel.js"/>'></script>
    <script src='<spring:url value="/resources/js/sysConfiguration/SysConfigurationService.js"/>'></script>
    <script src='<spring:url value="/resources/js/sysConfiguration/SysConfigurationController.js"/>'></script>
</head>
<style type="text/css">
     span {

     }

</style>
<body ng-app="sysApp" ng-controller="sysCtrl">
<div class="adcc-container sysConfiguration">
    <div class="col-md-12 collapse-active">
        <div class="input-group sysConfiguration-formBtn">
            <form class="form-inline">
                <div class="breadcrump">
                    <span ng-if="editFlag==1" ng-click="unlockPage()">
                      <img title="点击开锁" src="<%=request.getContextPath()%>/resources/pic/Lock.png">
                    </span>
                    <span ng-if="editFlag==0" ng-click="lockPage()">
                      <img title="点击上锁" src="<%=request.getContextPath()%>/resources/pic/Unlock.png">
                    </span>
                </div>
            </form>
        </div>

        <form method="post" id="formSys" name="formSys">
            <div>
                <ol class="breadcrumb">
                    <li class="active">核心网关配置</li>
                </ol>
            </div>
            <div class="adcc-sysConfiguration-content">
            <table solid="#ccc" width="100%" class="sysConfiguration">
                <tr>
                    <td class="sysConfiguration-labTitle">
                        <span>主用GW名称：</span>
                    </td>
                    <td>
                        <input type="text" class="form-control" id="GWMasterName" name="GWMasterName"
                               ng-model="GWMasterName" ng-readonly="editFlag"
                               ng-maxlength="100"
                               ng-pattern="/^[0-9A-Za-z]{3,100}$/"
                               required
                              class="bubble-title"
                               data-toggle="tooltip" data-placement="top" title="{{GWMasterName}}">
                        <small ng-show="formSys.GWMasterName.$error.maxlength"><span class="font-style">最大字符长度3-100</span>
                        </small>
                        <small ng-show="formSys.GWMasterName.$error.pattern"><span class="font-style">请输入字母或数字</span>
                        </small>
                    </td>

                    <td class="sysConfiguration-labTitle">
                        <span>主用GW IP：</span>
                    </td>
                    <td>
                        <input type="text" class="form-control" id="GWMasterIP" name="GWMasterIP"
                               ng-model="GWMasterIP" ng-readonly="editFlag"
                               ng-maxlength="100"
                               ng-pattern="/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/"
                               required
                              class="bubble-title"
                               data-toggle="tooltip" data-placement="top" title="{{GWMasterIP}}">
                        <small ng-show="formSys.GWMasterIP.$error.maxlength"><span class="font-style">最大字符长度100</span>
                        </small>
                        <small ng-show="formSys.GWMasterIP.$error.pattern"><span class="font-style">请输入合法的IP</span>
                        </small>
                    </td>
                </tr>
                <tr>
                    <td class="sysConfiguration-labTitle">
                        <span>备用GW名称：</span>
                    </td>
                    <td>
                        <input type="text" class="form-control" id="GWSlaveName" name="GWSlaveName"
                               ng-model="GWSlaveName" ng-readonly="editFlag"
                               ng-maxlength="100"
                               ng-pattern="/^[0-9A-Za-z]{3,100}$/"
                               required
                              class="bubble-title"
                               data-toggle="tooltip" data-placement="top" title="{{GWSlaveName}}">
                        <small ng-show="formSys.GWSlaveName.$error.maxlength"><span class="font-style">字符长度3-100</span>
                        </small>
                        <small ng-show="formSys.GWSlaveName.$error.pattern"><span class="font-style">请输入字母或数字</span>
                        </small>
                    </td>
                    <td class="sysConfiguration-labTitle">
                        <span>备用GW IP：</span>
                    </td>
                    <td>
                        <input type="text" class="form-control" id="GWSlaveIP" name="GWSlaveIP"
                               ng-model="GWSlaveIP" ng-readonly="editFlag"
                               ng-maxlength="100"
                               ng-pattern="/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/"
                               required
                              class="bubble-title"
                               data-toggle="tooltip" data-placement="top" title="{{GWSlaveIP}}">
                        <small ng-show="formSys.GWSlaveIP.$error.maxlength"><span class="font-style">最大字符长度100</span>
                        </small>
                        <small ng-show="formSys.GWSlaveIP.$error.pattern"><span class="font-style">请输入合法的IP</span>
                        </small>
                    </td>
                </tr>
                <tr>
                    <td class="sysConfiguration-labTitle">
                        <span>服务URL：</span>
                    </td>
                    <td>
                        <input type="text" class="form-control" id="gwServiceUrl" name="gwServiceUrl"
                               ng-model="gwServiceUrl" ng-readonly="editFlag"
                               ng-maxlength="300"
                               ng-pattern="/^((http)://)(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,4})*(/[a-zA-Z0-9\&%_\./-~-]*)?$/"
                               required
                              class="bubble-title"
                               data-toggle="tooltip" data-placement="top" title="{{gwServiceUrl}}">
                        <small ng-show="formSys.gwServiceUrl.$error.maxlength"><span class="font-style">最大字符长度300</span>
                        </small>
                        <small ng-show="formSys.gwServiceUrl.$error.pattern"><span class="font-style">请输入合法的URL</span>
                        </small>
                    </td>
                    <td class="sysConfiguration-labTitle">
                        <span>服务监控URL：</span>
                    </td>
                    <td>
                        <input type="text" class="form-control" id="userMonitorUrl" name="userMonitorUrl"
                               ng-model="userMonitorUrl" ng-readonly="editFlag"
                               ng-maxlength="300"
                               ng-pattern="/^((http)://)(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,4})*(/[a-zA-Z0-9\&%_\./-~-]*)?$/"
                               required
                              class="bubble-title"
                               data-toggle="tooltip" data-placement="top" title="{{userMonitorUrl}}">
                        <small ng-show="formSys.userMonitorUrl.$error.maxlength"><span
                                class="font-style">最大字符长度300</span></small>
                        <small ng-show="formSys.userMonitorUrl.$error.pattern"><span class="font-style">请输入合法的URL</span>
                        </small>
                    </td>
                </tr>
                <tr>
                    <td class="sysConfiguration-labTitle">
                        <span>硬件监控URL：</span>
                    </td>
                    <td>
                        <input type="text" class="form-control" id="sysMonitorUrl" name="sysMonitorUrl"
                               ng-model="sysMonitorUrl"
                               ng-maxlength="300"
                               ng-pattern="/^((http)://)(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,4})*(/[a-zA-Z0-9\&%_\./-~-]*)?/"
                               ng-readonly="editFlag" required
                              class="bubble-title"
                               data-toggle="tooltip" data-placement="top" title="{{sysMonitorUrl}}">
                        <small ng-show="formSys.sysMonitorUrl.$error.maxlength"><span
                                class="font-style">最大字符长度300</span></small>
                        <small ng-show="formSys.sysMonitorUrl.$error.pattern"><span class="font-style">请输入合法的URL</span>
                        </small>
                    </td>
                    <td class="sysConfiguration-labTitle">
                        <span>网络监测URL：</span>
                    </td>
                    <td>
                        <input type="text" class="form-control" id="gwNetworkMonitorUrl" name="gwNetworkMonitorUrl"
                               ng-model="gwNetworkMonitorUrl"
                               ng-maxlength="300"
                               ng-pattern="/^((http)://)(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,4})*(/[a-zA-Z0-9\&%_\./-~-]*)?/"
                               ng-readonly="editFlag" required
                              class="bubble-title"
                               data-toggle="tooltip" data-placement="top" title="{{gwNetworkMonitorUrl}}">
                        <small ng-show="formSys.gwNetworkMonitorUrl.$error.maxlength"><span
                                class="font-style">最大字符长度300</span></small>
                        <small ng-show="formSys.gwNetworkMonitorUrl.$error.pattern"><span class="font-style">请输入合法的URL</span>
                        </small>
                    </td>
                </tr>
            </table>

            <div>
                <ol class="breadcrumb">
                    <li class="active">MQ配置</li>
                </ol>
            </div>
            <table solid="#ccc" width="100%" class="sysConfigTable">
                <tr>
                    <td class="sysConfiguration-labTitle">
                        <span>QM连接数：</span>
                    </td>
                    <td>
                        <input type="text" class="form-control" id="qmConnNumber" name="qmConnNumber"
                               ng-model="qmConnNumber"
                               ng-readonly="editFlag" required ng-maxlength="9" ng-pattern="/^(0|[1-9]\d*)$/">
                        <small ng-show="formSys.qmConnNumber.$error.maxlength"><span class="font-style">数字长度需9位以内</span>
                        </small>
                        <small ng-show="formSys.qmConnNumber.$error.pattern"><span class="font-style">请输入非负整数</span>
                        </small>
                    </td>
                    <td class="sysConfiguration-labTitle">
                        <span>队列深度阀值：</span>
                    </td>
                    <td><input type="text" class="form-control" id="queueDepthThreshold" name="queueDepthThreshold"
                               ng-model="queueDepthThreshold" ng-readonly="editFlag" required ng-maxlength="9"
                               ng-pattern="/^(0|[1-9]\d*)$/">
                        <small ng-show="formSys.queueDepthThreshold.$error.maxlength"><span
                                class="font-style">数字长度需9位以内</span></small>
                        <small ng-show="formSys.queueDepthThreshold.$error.pattern"><span
                                class="font-style">请输入非负整数</span></small>
                    </td>

                    <td class="sysConfiguration-labTitle">
                        <span>硬件监控URL：</span>
                    </td>
                    <td>
                        <input type="text" class="form-control" id="MQSysMonitorUrl" name="MQSysMonitorUrl"
                               ng-model="MQSysMonitorUrl"
                               ng-maxlength="300"
                               ng-pattern="/^((http)://)(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,4})*(/[a-zA-Z0-9\&%_\./-~-]*)?/"
                               ng-readonly="editFlag" required
                              class="bubble-title"
                               data-toggle="tooltip" data-placement="top" title="{{MQSysMonitorUrl}}">
                        <small ng-show="formSys.MQSysMonitorUrl.$error.maxlength"><span
                                class="font-style">最大字符长度300</span></small>
                        <small ng-show="formSys.MQSysMonitorUrl.$error.pattern"><span class="font-style">请输入合法的URL</span>
                        </small>
                    </td>
                </tr>
            </table>

            <div>
                <ol class="breadcrumb">
                    <li class="active">GMS配置</li>
                </ol>
            </div>
            <table solid="#ccc" width="100%" class="sysConfigTable">
                <tr>
                    <td>
                        <span>管理员默认页面：</span>
                    </td>
                    <td>
                        <select class="form-control" id="adminDefaultUrl" ng-model="adminDefaultUrl"
                                ng-init="adminDefaultUrl='turn?url=mq/channel'"
                                ng-disabled="editFlag">
                            <option value='turn?url=mq/qm'>队列管理器</option>
                            <option value='turn?url=mq/channel'>通道</option>
                            <option value='turn?url=mq/topic'>会话</option>
                            <option value='turn?url=mq/sysQueue'>系统队列</option>
                            <option value='turn?url=mq/usrQueue'>用户队列</option>
                        </select>
                    </td>
                    <td>

                    </td>
                    <td>
                        <span>值班员默认页面：</span>
                    </td>
                    <td>
                        <select class="form-control" id="monitorUserDefaultUrl" ng-model="monitorUserDefaultUrl"
                                ng-init="monitorUserDefaultUrl='turn?url=gw/userMonitor' "
                                ng-disabled="editFlag">
                            <option value='turn?url=mq/qm'>队列管理器</option>
                            <option value='turn?url=mq/channel'>通道</option>
                            <option value='turn?url=mq/topic'>会话</option>
                            <option value='turn?url=gw/userMonitor'>用户监控</option>
                            <option value='turn?url=gw/queueMonitor'>队列监控</option>
                            <option value='turn?url=gw/traffic'>报文查询</option>
                            <option value='turn?url=gw/log'>日志查询</option>
                        </select>
                    </td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td>
                        <span>管理员登录名：</span>
                    </td>
                    <td>
                        <input type="text" class="form-control" id="adminUserName" name="adminUserName"
                               ng-model="adminUserName" ng-readonly="editFlag"
                               ng-maxlength="50" ng-pattern="/^[0-9|a-z|A-Z]{5,50}$/" required>
                        <input type="text" class="hidden" id="adminUserPwd" name="adminUserPwd" ng-model="adminUserPwd">
                        <small ng-show="formSys.adminUserName.$error.maxlength"><span class="font-style">最大字符长度50</span>
                        </small>
                        <small ng-show="formSys.adminUserName.$error.pattern"><span
                                class="font-style">请输入5-50位以内字母或数字</span></small>
                    </td>
                    <td>
                        <button class="btn sysConfiguration-btnSubmit" id="btnAdminUpdate"
                                ng-click="updatePwd(0)" disabled="disabled">修改密码
                        </button>
                    </td>
                    <td>
                        <span>值班员登录名：</span>
                    </td>
                    <td>
                        <input type="text" class="form-control" id="monitorUserName" name="monitorUserName"
                               ng-model="monitorUserName" ng-readonly="editFlag"
                               ng-maxlength="50" ng-pattern="/^[0-9|a-z|A-Z]{5,50}$/" required>
                        <input type="text" class="hidden" id="monitorUserPwd" name="monitorUserPwd"
                               ng-model="monitorUserPwd">
                        <small ng-show="formSys.monitorUserName.$error.maxlength"><span
                                class="font-style">最大字符长度50</span></small>
                        <small ng-show="formSys.monitorUserName.$error.pattern"><span
                                class="font-style">请输入5-50位以内字母或数字</span></small>
                    </td>
                    <td>
                        <button class="btn sysConfiguration-btnSubmit" id="btnMonitorUpdate"
                                ng-click="updatePwd(1)" disabled="disabled">修改密码
                        </button>
                    </td>
                </tr>
            </table>

            <div class="row">
                <div class="col-md-4 col-md-offset-11">
                    <button id="btnSysSave" name="btnSysSave" type="submit" ng-click="updateSys(formSys.$invalid)"
                            disabled="disabled" class="btn btn-primary">保存
                    </button>
                </div>
            </div>
            </div>
        </form>
    </div>
</div>

<%--修改密码共用模态框--%>
<div class="modal fade" id="dialogUpdatePwd" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     style="margin-top: 100px;pxoverflow-y: auto" data-backdrop="static">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">
                    <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>{{ title }}
                </h4>
            </div>
            <div class="modal-body">
                <form name="pwdForm" id="pwdForm" method="post">
                    <div class="form-group">
                        <label for="pwd">密码</label>
                        <input type="password" class="form-control" name="pwd" id="pwd" ng-model="pwd" ng-maxlength="50"
                               ng-pattern="/^[0-9|a-z|A-Z]{6,50}$/"
                               ng-blur="change(true)" ng-focus="change(false)" required>
                        <small ng-show="pwdForm.pwd.$error.maxlength && changed"><span
                                class="font-style">最大字符长度50</span></small>
                        <small ng-show="pwdForm.pwd.$error.pattern && changed"><span
                                class="font-style">请输入6-50位以内字母或数字</span></small>
                    </div>
                    <div class="form-group">
                        <label for="pwdAgain">确认密码</label>
                        <input type="password" class="form-control" name="pwdAgain" id="pwdAgain" ng-model="pwdAgain"
                               ng-maxlength="50"
                               ng-pattern="/^[0-9|a-z|A-Z]{6,50}$/" ng-blur="change(true)" ng-focus="change(false)"
                               required>
                        <small ng-show="pwdForm.pwdAgain.$error.maxlength && changed"><span
                                class="font-style">最大字符长度50</span></small>
                        <small ng-show="pwdForm.pwdAgain.$error.pattern && changed"><span class="font-style">请输入6-50位以内字母或数字</span>
                        </small>
                    </div>
                </form>
                <div class="row">
                    <div class="col-md-3 col-md-offset-9">
                        <button type="submit" ng-disabled="pwdForm.$invalid" ng-click="savePwd()"
                                class="btn btn-primary">确认
                        </button>
                        <button type="button" ng-click="cancel()" class="btn btn-danger">取消</button>
                    </div>
                </div>
            </div>
        </div>
        <%--modal-content--%>
    </div>
    <%--modal-dialog--%>
</div>
</body>
</html>
